package org.base.common.fs;

import org.base.common.pojo.FileInfo;
import org.springframework.web.multipart.MultipartFile;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * 文件系统
 */
public interface FileSystem {

    /**
     * 上传文件
     *
     * @param file
     * @return
     */
    FileInfo upload(MultipartFile file) throws IOException;

    /**
     * 获取文件输入流
     *
     * @param fileName
     * @return
     */
    InputStream getFileInputStream(String fileName) throws FileNotFoundException;

    /**
     * @param dir      目录
     * @param fileName 文件名
     * @return
     * @throws FileNotFoundException
     */
    InputStream getFileInputStream(String dir, String fileName) throws FileNotFoundException;
}
